﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.ServiceModel.Web;
using System.Text;
using dis.sys.hw1.Contract;
using dis.sys.hw1.Model;

namespace dis.sys.hw1.ClientProxy
{
    public class HotelServiceProxy : ClientBase<IHotelService>, IHotelService
    {
        public HotelServiceProxy(ServiceEndpoint endpoint)
            : base(endpoint)
        {
            InnerChannel.OperationTimeout = new TimeSpan(0,2,0,0);
        }

        #region Implementation of IHotelService

        public Hotel GetAvailableRooms(string hotelName, DateTime fromDate, DateTime toDate, double minStars = 0, double minRating = 0)
        {
            return Channel.GetAvailableRooms(hotelName, fromDate, toDate, minStars, minRating);
        }

        public int BookRoom(string hotelName, DateTime fromDate, DateTime toDate, int roomNumber)
        {
            return Channel.BookRoom(hotelName, fromDate, toDate, roomNumber);
        }

        public bool Cancel(string hotelName, int bookingId)
        {
            return Channel.Cancel(hotelName, bookingId);
        }

        public IEnumerable<string> GetHotelNames()
        {
            return Channel.GetHotelNames();
        }

        public double GetStars(string hotelName)
        {
            return Channel.GetStars(hotelName);
        }

        public double GetRating(string hotelName)
        {
            return Channel.GetRating(hotelName);
        }

        public bool IsHotelInQueryRange(string hotelName, double minStars, double minRating)
        {
            return Channel.IsHotelInQueryRange(hotelName, minStars, minRating);
        }

        public bool AddHotelToBackUp(IDictionary<string, Hotel> data)
        {
            return Channel.AddHotelToBackUp(data);
        }
        #endregion






    }
}
